package com.nicy.dream.config;


import com.nicy.dream.common.AutoIdempotent;
import com.nicy.dream.common.AutoIdempotentInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import javax.annotation.Resource;

/**
 * @description: 拦截器配置
 * @projectName:dream
 * @see:com.nicy.dream.config
 * @author:NicyYe
 * @createTime:2021/2/19 15:53
 * @version:1.0
 */
@Configuration
//@Component
//public class WebConfiguration extends WebMvcConfigurerAdapter {
public class WebConfig implements WebMvcConfigurer {

    @Resource
    private AutoIdempotentInterceptor autoIdempotentInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry){
        registry.addInterceptor(autoIdempotentInterceptor).addPathPatterns("/**");
    }
}
